//app.js
App({
  onLaunch: function () {
    
  },
  editTabBar: function (tabBar) {
    var _curPageArr = getCurrentPages();
    var _curPage = _curPageArr[_curPageArr.length - 1];
    var _pagePath = _curPage.__route__;
    if (_pagePath.indexOf('/') != 0) {
      _pagePath = '/' + _pagePath;
    }
    
    for (var i = 0; i < tabBar.list.length; i++) {
      tabBar.list[i].active = false;
      if (tabBar.list[i].pagePath == _pagePath) {
        tabBar.list[i].active = true;//根据页面地址设置当前页面状态    
      }
    }
    _curPage.setData({
      tabBar: tabBar
    });
  }, 
  globalData: {
    identity:0,
    userInfo:"",
    tabBar: {
      "color": "#9E9E9E",
      "selectedColor": "#ff0000",
      "backgroundColor": "#fff",
      "borderStyle": "#ccc",
      "list": [
        {
          "pagePath": "/pages/shop/home/home",
          "text": "首页",
          "iconPath": "/img/home.png",
          "selectedIconPath": "/img/homeSelected.png",
          "clas": "menu-item",
          "selectedColor": "#d81e06",
          active: true
        },
        {
          "pagePath": "/pages/user/order/order",
          "text": "订单",
          "iconPath": "/img/cart.png",
          "selectedIconPath": "/img/cartSelected.png",
          "selectedColor": "#d81e06",
          "clas": "menu-item",
          active: false
        },
        {
          "pagePath": "/pages/shop/info/info",
          "text": "我",
          "iconPath": "/img/user.png",
          "selectedIconPath": "/img/userSelected.png",
          "selectedColor": "#d81e06",
          "clas": "menu-item",
          active: false
        }
      ],
      "position": "bottom"
    },
    tabBar1: {
      "color": "#9E9E9E",
      "selectedColor": "#ff0000",
      "backgroundColor": "#fff",
      "borderStyle": "#ccc",
      "list": [
        {
          "pagePath": "/pages/user/home/home",
          "text": "首页",
          "iconPath": "/img/home.png",
          "selectedIconPath": "/img/homeSelected.png",
          "clas": "menu-item",
          "selectedColor": "#d81e06",
          active: true
        },
        {
          "pagePath": "/pages/user/cart/cart",
          "text": "购物车",
          "iconPath": "/img/cart.png",
          "selectedIconPath": "/img/cartSelected.png",
          "selectedColor": "#d81e06",
          "clas": "menu-item",
          active: false
        },
        {
          "pagePath": "/pages/user/info/info",
          "text": "我",
          "iconPath": "/img/user.png",
          "selectedIconPath": "/img/userSelected.png",
          "selectedColor": "#d81e06",
          "clas": "menu-item",
          active: false
        }
      ],
      "position": "bottom"
    },
    JSESSIONID:""
  }
})